package com.by.yz.activity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.app.AlertDialog;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.volley.toolbox.NetworkImageView;
import com.by.yz.App;
import com.by.yz.R;
import com.by.yz.activity.base.BaseActivity;
import com.by.yz.custom.CircleNetworkImageView;
import com.by.yz.entity.Doctorbean;
import com.by.yz.util.IsNetWork;

/**
 * Created by 你只能呵呵 on 2016/10/15.
 */

public class DoctorIntroduct extends BaseActivity {
    CircleNetworkImageView header;
    TextView name,keshi,touxian,hospital,instruct,school;
    IsNetWork isNetWork;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.xiangqing);
        setToolbarTitle("医生详情");

    }

    @Override
    protected void onStart() {
        super.onStart();
        if (isNetWork.isNetworkAvailable(this)) {
            Intent intent = this.getIntent();
            final Doctorbean team = (Doctorbean) intent.getSerializableExtra("doctorid");
            header = (CircleNetworkImageView) findViewById(R.id.famous_doctor_image);
            header.setDefaultImageResId(R.mipmap.login_logo1);
            header.setErrorImageResId(R.mipmap.login_error);
            header.setImageUrl(team.getmImageView(), App.imageLoader);
            name = (TextView) findViewById(R.id.famous_doctor_name_textview);
            name.setText(team.getDoctorname());
            keshi = (TextView) findViewById(R.id.keshi_textview);
            keshi.setText(team.getDepartment().getDepartment());
            touxian = (TextView) findViewById(R.id.touxian_textview);
            touxian.setText(team.getPosition());
            hospital = (TextView) findViewById(R.id.hospital_textview);
            hospital.setText(team.getTextHospital().getHospital());
            instruct = (TextView) findViewById(R.id.yishengjieshao);
            instruct.setText(team.getResume());
            school = (TextView) findViewById(R.id.school);
            school.setText(team.getSchool());
        }else{
            //无网络连接情况
            new AlertDialog.Builder(DoctorIntroduct.this)
                    .setTitle("提示!")
                    .setIcon(android.R.drawable.ic_dialog_info)
                    .setMessage("检测到您还没开启网络，请开启")
                    .setNegativeButton("取消", null)
                    .setPositiveButton("开启",
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog,
                                                    int which) {
                                    startActivity(new Intent(
                                            Settings.ACTION_WIRELESS_SETTINGS));// 进入无线网络配置界面
                                }
                            }).show();
        }
    }
}
